package com.jihui.jihuipicturebackend.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jihui.jihuipicturebackend.api.ailiyunai.model.CreateOutPaintingTaskResponse;
import com.jihui.jihuipicturebackend.model.dto.picture.*;
import com.jihui.jihuipicturebackend.model.entity.Picture;
import com.jihui.jihuipicturebackend.model.entity.User;
import com.jihui.jihuipicturebackend.model.vo.PictureVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author wu'ji'hui
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-01-16 14:05:28
*/
public interface PictureService extends IService<Picture> {

    /**
     * 上传图片
     *
     * @param inputResource
     * @param pictureUploadRequest
     * @param loginUser
     * @return
     */
    PictureVO uploadPicture(Object inputResource,
                            PictureUploadRequest pictureUploadRequest,
                            User loginUser);

    /**
     * 根据图片id删除图片
     * @param pictureId
     * @return
     */
    boolean deletePictureById(Long pictureId, User loginUser);

    /**
     * 更新图片
     * @param multipartFile
     * @param pictureUpdateRequest
     * @param loginUser
     * @return
     */
    PictureVO updatePicture (MultipartFile multipartFile,
                             PictureUpdateRequest pictureUpdateRequest,
                             User loginUser);


    /**
     * 构造查询条件
     * @param pictureQueryRequest
     * @return
     */
    QueryWrapper<Picture> getPictureQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 获取单个图片的VO
     * @param picture
     * @param request
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 获取单个图片的VO（分页）
     * @param picturePage
     * @param httpServletRequest
     * @return
     */
    Page<PictureVO> getPictureListVO(Page<Picture> picturePage, HttpServletRequest httpServletRequest);


    /**
     * 校验图片信息
     * @param picture
     */
    void validPicture(Picture picture);

    /**
     * 图片审核状态修改
     * @param pictureReviewStatusRequest
     * @param loginUser
     * @return
     */
    boolean pictureReviewStatus(PictureReviewStatusRequest pictureReviewStatusRequest, User loginUser);

    /**
     * 重置图片审核状态
     * @param picture
     * @param loginUser
     */
    void reviewStatus(Picture picture, User loginUser);

    /**
     * 通过搜索词批量上传图片
     *
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return
     */
    int pictureUploadByBatch(PictureUploadByBatchRequest pictureUploadByBatchRequest,
                             User loginUser);

    /**
     * 检查图片权限
     * @param loginUser
     * @param picture
     */
    void checkPictureAuth(User loginUser, Picture picture);

    /**
     * 根据图片主色调获取图片列表
     *
     * @param spaceId
     * @param picColor
     * @param loginUser
     * @return
     */
    List<PictureVO> getPictureListByColor(Long spaceId, String picColor, User loginUser);

    /**
     * AI 阔图任务创建
     *
     * @param createPictureOutPaintingTaskRequest
     * @param loginUser
     * @return
     */
    CreateOutPaintingTaskResponse createOutPaintingTask(CreatePictureOutPaintingTaskRequest createPictureOutPaintingTaskRequest, User loginUser);


}
